import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';

import './page/home.dart';
import './page/profile.dart';

class RouteRule {
  static String root = "/";
  static String home = "/home";
  static String profile = "/profile";
  static String setting = "/setting";

  static Router router;

  static void configureRouteRule(Router router) {
    router.notFoundHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
        print("ROUTE WAS NOT FOUND !!!");
        return null;  // FIXME: should return a widget.
      },
    );

    router.define(home, handler: Handler(handlerFunc: _HomeHandler));
    router.define(profile, handler: Handler(handlerFunc: _ProfileHandler));

    RouteRule.router = router;
  }

  static Widget _HomeHandler(
      BuildContext context, Map<String, List<String>> params) {
    return HomePage();
  }

  static Widget _ProfileHandler(
      BuildContext context, Map<String, List<String>> params) {
    return ProfilePage();
  }
}
